﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace XNAchievement
{
    /// <summary>
    /// A INotificationHandler that writes notifications to the Debug
    /// Listeners. For debugging.
    /// </summary>
    public class DebugNotificationHandler : INotificationHandler
    {
        DebugFormatter formatter = new DebugFormatter();
        
        #region INotificationHandler Member

        public void HandleAnyNotification(object sender, AnyNotificationEventArgs e)
        {
            switch (e.NotificationType)
            {
                case NotificationType.Unlocked:
                    Debug.WriteLine(string.Format("{0}: Unlocked!", e.Achievement.AsString(formatter)));
                    break;
                case NotificationType.Progressed:
                    Debug.WriteLine("{0}: Progressed to {1:##%}", e.Achievement.AsString(formatter), (float)e.UserData);
                    break;
                case NotificationType.Special:
                    Debug.WriteLine("{0}: Special event. UserData: {1}", e.Achievement.AsString(formatter), e.UserData);
                    break;
            }
        }

        #endregion
    }
}
